<!DOCTYPE html>
<html lang="en">
  	<head>
	    <meta charset="utf-8">
	    <title>学生管理系统</title>
	    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	    <meta name="description" content="">
	    <meta name="author" content="">

	    <!-- Bootstrap core CSS -->
	    <link href="/admin/bootstrap/css/bootstrap.min.css" rel="stylesheet">
		
		<!-- Font Awesome -->
		<link href="/admin/css/font-awesome.min.css" rel="stylesheet">

		<!-- ionicons -->
		<link href="/admin/css/ionicons.min.css" rel="stylesheet">
		
		<!-- Simplify -->
		<link href="/admin/css/simplify.min.css" rel="stylesheet">
	
  	</head>

  	<body class="overflow-hidden light-background">
		<div class="wrapper no-navigation preload">
			<div class="sign-in-wrapper">
				<div class="sign-in-inner">
					<div class="login-brand text-center">
						<i class="fa fa-database m-right-xs"></i> 学生 <strong class="text-skin">管理系统</strong>
					</div>

					<form id="loginForm">
						<div class="form-group m-bottom-md">
							<input type="email" name="email" class="form-control" placeholder="请输入邮箱">
						</div>
						<div class="form-group">
							<input type="password" name="pwd" class="form-control" placeholder="请输入密码">
						</div>
						<div class="form-group">
							<input type="text" style="width: 200px;" class="form-control" placeholder="请输入验证码">
							<img src="/admin/main/imgCode" alt="" class="pull-right" onclick="this.src='/admin/main/imgCode?m='+Math.random()">
							<div class="clearfix"></div>
						</div>

						<div class="form-group">
							<div class="custom-checkbox">
								<input type="checkbox" id="chkRemember" name="remeber">
								<label for="chkRemember"></label>
							</div>
							记住我
						</div>

						<div class="m-top-md p-top-sm">
							<a href="javascript:;" class="btn btn-success block" id="login">立即登录</a>
						</div>

						<div class="m-top-md p-top-sm">
							<!-- <div class="font-12 text-center m-bottom-xs">
								<a href="#" class="font-12">Forgot password ?</a>
							</div> -->
							<div class="font-12 text-center m-bottom-xs">我没有账号?</div>
							<a href="/admin/main/register" class="btn btn-default block">注册一个账号</a>
						</div>
					</form>
				</div><!-- ./sign-in-inner -->
			</div><!-- ./sign-in-wrapper -->
		</div><!-- /wrapper -->

		<a href="" id="scroll-to-top" class="hidden-print"><i class="icon-chevron-up"></i></a>

	    <!-- Le javascript
	    ================================================== -->
	    <!-- Placed at the end of the document so the pages load faster -->
		
		<!-- Jquery -->
		<script src="/admin/js/jquery-1.11.1.min.js"></script>
		
		<!-- Bootstrap -->
	    <script src="/admin/bootstrap/js/bootstrap.min.js"></script>
		
		<!-- Slimscroll -->
		<script src='/admin/js/jquery.slimscroll.min.js'></script>
		
		<!-- Popup Overlay -->
		<script src='/admin/js/jquery.popupoverlay.min.js'></script>

		<!-- Modernizr -->
		<script src='/admin/js/modernizr.min.js'></script>
		
		<!-- Simplify -->
		<script src="/admin/js/simplify/simplify.js"></script>
		
		<!-- 验证函数 -->
		<script src="/admin/js/common.js"></script>
		
		<script>
			// 登录页面，写ajax提交操作
			$('#login').on('click',function(){
				var formdata = new FormData($('#loginForm')[0]);  // 括号是js表单对象
				if(!checkEmail(formdata.get('email'))){
					alert('请正确输入邮箱');
					return false;
				}
				if(checkRequired(formdata.get('pwd'))){
					alert('请输入密码');
					return false;
				}
				$.ajax({
					url: '/admin/main/loginData',
					type:'post',
					data:formdata,
					contentType: false,
        			processData: false,
					dataType:'json',	// 回调的数据类型
					success:function(res){
						alert(res.msg);
						if(res.error==0){
							//跳转到后台主页
							location.href = '/admin/main/main_index';
						}
					}
				});
			});
			
		</script>
  	</body>
</html>
